package com.mgfireworks.mgplatform.mgadmin.sys;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import cn.hn.java.summer.annotation.ParamValid;

import com.mgfireworks.mgplatform.mgadmin.sys.model.Area;

/**
 * 
 * @author nap
 * 20161015-10:19:48
 * 区域控制器
 */
@Controller
@RequestMapping("/sys/area")
public class AreaController {

	@Autowired
	AreaService areaService;
	
	/**
	 * 区域列表
	 * @return
	 */
	@RequestMapping("/list")
	public List<Area> list(Area p){
		return areaService.getAreas(p);
	}

	/**
	 * 添加区域
	 */
	@RequestMapping(value="/add",method=RequestMethod.GET)
	public void add(){
	}
	
	/**
	 * 提交添加区域
	 */
	@RequestMapping(value="/add",method=RequestMethod.POST)
	public void postAdd(@ParamValid Area p){
		areaService.addArea(p);
	}

	/**
	 * 编辑区域
	 */
	@RequestMapping(value="/edit",method=RequestMethod.GET)
	public Area edit(Area p){
		return areaService.getArea(p);
	}
	
	/**
	 * 提交编辑区域
	 */
	@RequestMapping(value="/edit",method=RequestMethod.POST)
	public void postEdit(@ParamValid Area p){
		areaService.editArea(p);
	}
	
	/**
	 * 获取区域
	 */
	@RequestMapping(value="/get",method=RequestMethod.GET)
	public Area get(Area p){
		return areaService.getArea(p);
	}
	
	/**
	 * 删除区域
	 */
	@RequestMapping("/del")
	public void del(Area p){
		areaService.delArea(p);
	}
	
	/**
	 * 条件查询
	 */
	@RequestMapping("/search")
	public void search(Area p){
		System.out.println("111");
	}
}